<{include file="www/header.tpl"}>

<header class="homepage-header">

    <div class="top-info fix">
        <div class="left">
            <a href="/"><h1 class="logo"><img src="/resource/www/imgs/logo.png" alt="" class="img"></h1></a>
            <a class="a" href="/line">搜罗玩法</a>
            <a class="a" href="/scenicspot">景点图书馆</a>
            <a class="a" href="/customize/">哇吖定制</a>
        </div>
        <div class="right">

            <{if $global_user.userUid > 0}>
            <{if $global_user.userType == 'GUIDER'}>
            <div class="login-succ fix">
                <div class="name" onmouseover="show_succ_menu(this);" onmouseout="hide_succ_menu(this);" style="color: #fff;">
                    <p class="txt"><{$global_user.userName}></p>
                    <ul class="menu">
                        <li class="menuli"><a class="a" target="_blank" href="/guider/info">基本信息</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/guider/show_identity">认证</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/guider/track_list">路线活动</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/guider/message">我的留言</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/guider/orders_request">游客预定</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/guider/my_orders/">我的订单</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/guider/bank_list">收款账户</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/guider/recieved_comments">我的点评</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/guider/notice">我的提醒</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/guider/prize">奖励</a></li>
                        <li class="menuli"><a class="a" href="/user/logout">退出登录</a></li>
                    </ul>
                </div>
                <{if $global_user.userIcon}>
            <img src="<{$global_user.userIcon}>" alt="" class="img">
                <{/if}>
                <a href="/guider/notice"><span class="news2">
                    <{if $notice}>
                      <em class="number"><{$notice}></em>
                    <{/if}>
                </span></a>
            </div>

            <{else}>
            <div class="login-succ fix">
                <div class="name" onmouseover="show_succ_menu(this);" onmouseout="hide_succ_menu(this);" style="color:#fff;">
                    <p class="txt"><{$global_user.userName}></p>
                    <ul class="menu">
                        <li class="menuli"><a class="a" target="_blank" href="/tourist/info">基本信息</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/tourist/credit">邮箱认证</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/tourist/orders">我的订单</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/tourist/message">我的留言</a></li>
                        <!--   <li class="menuli"><a class="a" href="/tourist/orders/track?type=track">我要申诉</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="mailto:info@wayatrip.com">我要申诉</a></li>-->
                        <li class="menuli"><a class="a" href="javascript:;" target="_blank" onclick="shensu()">我要申诉</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/tourist/notice">我的提醒</a></li>
                        <li class="menuli"><a class="a" target="_blank" href="/tourist/line_comments">我的点评</a></li>
                        <li class="menuli"><a class="a" href="/user/logout">退出登录</a></li>
                    </ul>
                </div>
                <{if $global_user.userIcon}>
            <img src="<{$global_user.userIcon}>" alt="" class="img">
                <{/if}>
                <a href="/tourist/notice"><span class="news2">
                    <{if $notice}>
                      <em class="number"><{$notice}></em>
                    <{/if}>
                </span></a>
                <a href="/order/itinerary" class="xcd2">
                   你的行程单
                </a>
            </div>
            <{/if}>
            <{else}>
            <span class="reg" onclick="showBox($('.register-wrap'), $('.alert-bg'));">注册</span>
            <span class="login" onclick="showBox($('.login-wrap'), $('.alert-bg'));">登陆</span>
            <{/if}>

        </div>
    </div>

    <ul class="bg-img loadimg">
        <{foreach from=$banners item="banner"}>
        <li class="li"><img class="img" src="<{$banner.iconUrl}>" alt=""></li>
        <{/foreach}>
    </ul>

    <div class="center-info">
        <h2 class="title"><{$strings.homepage_top_main_title}></h2>
        <p class="sub-title"><{$strings.homepage_top_sub_title}></p>
        <a target="_blank" href="/service/howto_rhcz" class="info">如何使用哇吖</a>
    </div>

    <div class="content-search">
        <form action="/line/homepage_search" class="search-form fix" method="post" id="search_form">
            <div class="city">
            <span class="text">目的地</span>
            <div class='city-wrap' style="display:none;">
              <ul class="country-box">
              <{foreach from=$cityList item=citys name=countryBox key=country}>
              <{if $smarty.foreach.countryBox.index==0}>     
              <li country="<{$country}>" class="active"><{$country}></li>
              <{else}>
              <li country="<{$country}>"><{$country}></li>
              <{/if}>
              <{/foreach}>
              </ul>

            <{foreach from=$cityList item=citys name=cityBox key=country}>
            <div class='city-item' country='<{$country}>' 
            <{if $smarty.foreach.cityBox.index==0}>
            <{else}>     
            style="display:none;"
            <{/if}>
            >
            
            <{foreach from=$citys item=city key=cityId}>
            <a href='javascript:void(0);' data='<{$cityId}>' country='<{$country}>'><{$city}></a>
            <{/foreach}>
            </div>
            <{/foreach}>
        
            <input type=hidden name='city'>  
            </div>
            
            </div>
            
            <input class="go-date" type="text" name="start" id="start" placeholder="出发日期" value="<{"Y-m-d"|@date}>">
            <input class="back-date" type="text" name="end" id="end" placeholder="返回日期">
            <select class="number" name="number">
                <option value="1">1 位游客</option>
                <option value="2">2 位游客</option>
                <option value="3">3 位游客</option>
                <option value="4">4 位游客</option>
                <option value="5">5 位游客</option>
                <option value="6">6 位游客</option>
                <option value="7">7 位游客</option>
                <option value="8">8 位游客</option>
                <option value="9">9 位游客</option>
                <option value="10">10 位游客</option>
                <option value="11">11 位游客</option>
                <option value="12">12 位游客</option>
                <option value="13">13 位游客</option>
                <option value="14">14 位游客</option>
                <option value="15">15 位游客</option>
            </select>
            <input class="route-btn" type="submit" id="search-btn" value="搜索">
        </form>
    </div>
</header>
<div class="homepage-trend-wrap">
<ul class="homepage-trend fix loadimg">
    <{foreach from=$articles item="article"}>
    <li class="li">
      <a target="_blank" href="/article/detail/<{$article.id}>" class="a">
            <img src="<{$article.thumb}>" alt="" class="img">
            <p class="biaoti"><{$article.title}></p>
        </a>
    </li>
    <{/foreach}>
</ul>
</div>

<{include file="www/homepage-line.tpl"}>

<div class="homepage-sort-wrap">
<h2 class="homepage-title fix">
    <span class="left"></span>
    <span class="center">当地丰富玩法</span>
    <span class="right"></span>
</h2>
<h3 class="homepage-subtitle">LIVE LOCAL LIFE</h3>

<{foreach from=$cates item="cat" name="cate"}>
    <{if $smarty.foreach.cate.index == 0}>
        <a  target="_blank" href="/line/index/<{$cat.id}>">
        <div class="homepage-sort-main" style="background-image: url('<{$cat.iconUrlWider}>');">
            <div class='wrap'>
            <p class="text"><{$cat.name}></p>
            </div>
        </div>
        </a>
    <{else}>
    <{/if}>
<{/foreach}>

<ul class="homepage-sort-ul fix loadimg">
    <{foreach from=$cates item="cat" name="cate"}>
    <{if $smarty.foreach.cate.index == 0}>
    <{else}>
    <li class="li">
        <a target="_blank" href="/line/index/<{$cat.id}>" class="a">
            <div class="homepage-ul-main" style="background-image: url('<{$cat.iconUrl}>');">
            <div class="wrap">
            <p class="text"><{$cat.name}></p>
            </div>
            </div>
        </a>
    </li>
    <{/if}>
    <{/foreach}>
</ul>

<a href="/line" class="homepage-click-more">查看更多玩法</a>
</div>
<!--
<div class="homepage-center-focus loadimg">
    <ul class="ul">
        <{foreach from=$mbanners item="banner"}>
        <li class="li">
            <a href="<{$banner.url}>" class="a">
                <img class="img" src="<{$banner.iconUrl}>" alt="">
            </a>
        </li>
        <{/foreach}>
    </ul>
    <ol class="ol">
        <{foreach from=$mbanners item="banner"}>
        <li class="li">
            <p class="title"><{$banner.name}></p>
            <p class="text"><{$banner.subtitle}></p>
        </li>
        <{/foreach}>
    </ol>
</div>
<div style="height:100px"></div>
-->

<script type="text/javascript">
 //城市选择
$(".city .text").click(function(e){
    e.stopPropagation();
    $('.city-wrap').toggle();
});
$('.country-box li').click(function(e){
    e.stopPropagation();
    $('.country-box li').removeClass('active'); 
    $(this).addClass('active');
    $('.city-item').hide();
    var country=$(this).attr('country');
    $('.city-item[country='+country+']').show();
});
$('.city-wrap .city-item a').click(function(){
    var id=$(this).attr('data');
    var city=$(this).html();
    $("input[name='city']").val(id);
    $('.city-wrap').hide();
    $('.city .text').html(city);
});
//点击其他地方隐藏
$(document).click(function() {
    $('.city-wrap').hide();
});

$("#search_form").submit(function(){
    var start=$('#start').val();
    var end=$('#end').val();
    oReg=/\d{4}-\d{2}-\d{2}/;
    if(start!=''&&!oReg.test(start))
    {
       layer.msg("日期格式非法，请重新选择");
       return false;
    }
    if(end!=''&&!oReg.test(end))
    {
       layer.msg("日期格式非法，请重新选择");
       return false;
    }
       return true;
});

$(function() {
    // 顶部轮播效果
    onFocus();
    // 中部轮播效果
    oCenterFocus();
    //玩法推荐轮播
    oHomepageNewLine();
    oHomepagePopLine();
});

function onFocus() {
    var oFocus = $('.homepage-header');
    var aLi = oFocus.find('ul .li');
    var iNow = 0;
    var timer = null;
    function fnFade() {
        aLi.each(function (i){
            if ( i != iNow ) {
                aLi.eq(i).fadeOut().css('zIndex', -2);

            } else {
                aLi.eq(i).fadeIn().css('zIndex', -1);
            }
        });
    }
    fnFade();
    function autoPlay() {
        timer = setInterval(function () {
            iNow++;
            iNow%=aLi.length;
            fnFade();
        }, 6000);
    }
    autoPlay();
}
function oHomepageNewLine(){
    var oNew= $('.homepage-line.new-line').find('.homepage-line-wrap');
    oTime1 = setInterval(function () {
	         var posleft=parseInt(oNew.css('left'));
	         if(posleft>-2400){
	            posleft-=345;
	            posleft+='px';
	         }else{posleft=0;}        
	         oNew.animate({left:posleft},'normal','swing');
             }, 3000);
}
function oHomepagePopLine(){
    var oPop= $('.homepage-line.pop-line').find('.homepage-line-wrap');
    oTime2 = setInterval(function () {
                 var posleft=parseInt(oPop.css('left'));
                 if(posleft>-2400){
                    posleft-=345;
                    posleft+='px';
                 }else{posleft=0;}        
                 oPop.animate({left:posleft},'normal','swing');
             }, 3000);
}
$('.homepage-line').mouseenter(function(){
    if($(this).hasClass('new-line')){
       clearInterval(oTime1);
    }else{clearInterval(oTime2);}
});
$('.homepage-line').mouseleave(function(){
    if($(this).hasClass('new-line')){
       oHomepageNewLine();
    }else{oHomepagePopLine();}   
});
function oCenterFocus() {
    var oFocus = $('.homepage-center-focus');
    var aLi = oFocus.find('.ul .li');
    var aOlLi = oFocus.find('.ol .li');
    var iNow = 0;
    var timer = null;
    function fnFade() {
        aLi.each(function (i){
            if ( i != iNow ) {
                aLi.eq(i).fadeOut().css('zIndex', -2);
                aOlLi.eq(i).fadeOut();
            } else {
                aLi.eq(i).fadeIn().css('zIndex', -1);
                aOlLi.eq(i).fadeIn();
            }
        });
    }
    fnFade();
    function autoPlay() {
        timer = setInterval(function () {
            iNow++;
            iNow%=aLi.length;
            fnFade();
        }, 6000);
    }
    autoPlay();
}

function show_succ_menu(item) {
    $(item).find('.menu').show();
}

function hide_succ_menu(item) {
    $(item).find('.menu').hide();
}

</script>

<{include file="www/widget_calendar.tpl"}>
<{include file="www/footer.tpl"}>
